Skip to content

feat: broadcast user prompts to frontend observers#19

Merged
axeldelafosse merged 1 commit intomainfrom
feat/broadcast-user-prompts-to-frontends
Feb 26, 2026
Merged

feat: broadcast user prompts to frontend observers#19
axeldelafosse merged 1 commit intomainfrom
feat/broadcast-user-prompts-to-frontends

Conversation

@axeldelafosse
Copy link
Copy Markdown
Owner

Summary

  • Fan out frontend-originated NDJSON to other connected frontends in handleFrontendMessage
  • Broadcast sendUserMessage payloads to frontends so observer UIs can render user prompts that aren't echoed back by the Claude SDK

Test plan

  • Connect multiple frontend WebSocket clients and verify user prompts appear on all observers
  • Verify messages are still forwarded to Claude correctly

Fan out user-originated NDJSON messages to all connected frontend
WebSocket clients so observer UIs can render user prompts that are
not echoed back by the Claude SDK.
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @axeldelafosse, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the real-time communication within the system by enabling the broadcasting of user prompts and frontend-originated messages to all connected frontend observers. This change allows for a more comprehensive and consistent view of the interaction flow across multiple UIs, ensuring that all user inputs are visible, even when not explicitly echoed by the Claude SDK.

Highlights

  • Frontend Message Broadcasting: Implemented broadcasting of NDJSON messages received from a frontend to all other connected frontends, allowing observer UIs to render user prompts that may not be echoed back by the Claude SDK.
  • User Prompt Broadcasting: Ensured that user messages generated internally by the sendUserMessage method are also broadcast to all connected frontends, providing a complete view of user interactions.
Changelog
  • src/loop/claude-sdk-server.ts
    • Added logic to broadcast incoming NDJSON messages from frontends to all other connected frontends.
    • Modified the sendUserMessage method to broadcast the user prompt payload to all frontends before sending it to the Claude SDK.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces functionality to broadcast user-originated messages to all connected frontend clients, enhancing observer UIs. However, the current implementation has a critical security vulnerability: the WebSocket server lacks security controls, potentially leading to information leakage of sensitive prompts and session data to unauthorized users due to its default binding to all interfaces (0.0.0.0) and absence of authentication or origin validation. It is recommended to restrict the server to localhost and add authentication. Additionally, there's a minor code duplication issue that could be refactored for better maintainability.

Comment thread src/loop/claude-sdk-server.ts
Comment thread src/loop/claude-sdk-server.ts
@axeldelafosse axeldelafosse merged commit 35327a5 into main Feb 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant